<template>
	<view class="page">
		<view class='bg-grey'>
			
			<view class="conf-list">
				<view class="conf-list-item" v-for="(item,index) in listData" :key="index">
					<view class="conf-list-card">
						<view class="conf-list-title" @click="goDetailed(item.workNo,item.month)">
							<view style="font-size: 20px;">
								{{item.workNo_dictText}}
								{{item.month}}
								<text>工资条</text>
							</view>
						</view>
						
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState,
		mapMutations
	} from 'vuex'
	export default {
		computed: {
			...mapState(['companyCode'])
		},
		data() {
			return {
				text: '暂无数据',
				title: '下拉刷新 + 加载更多',
				data: [],
				listData: [],
				pageNo: 0,
				endFlag: false,
				filter: "",
				loadMoreText: "加载中...",
				createBy: '',
				month:''
			};
		},

		onShow() {
			this.createBy = uni.getStorageSync('login_user_info').username
			this.loadMoreText = "加载更多";
		},
		onLoad(e) {
			this.initData();
		},
		mounted(){
		},
		onUnload() {
			this.max = 0;
			// this.data = [],
			this.listData = [];
		},
		onReachBottom() {
			if (this.endFlag == true) {
				this.loadMoreText = "已显示全部数据"
				uni.showToast({
					icon: 'none',
					title: this.loadMoreText
				});
				return;
			}
			setTimeout(() => {
				this.listData = []
				this.getList()
			}, 300);
		},
		onPullDownRefresh() {
			uni.stopPullDownRefresh();
		},
		methods: {
			confirm(e) {
				this.iconShow = false
				this.dateList = e.range.before + "~" + e.range.after
				this.pageNo = 0;
				this.getList()
			},
			
			initData() {
				setTimeout(() => {
					this.getList();
					uni.stopPullDownRefresh();
				}, 300);
			},
           //产品列表
			getList() {
				this.listData=[]
				let url = '/dcloud/hrPayroll/hrPayroll/list'
				this.pageNo+=1
				this.$http.get(url, {
					params: {
						"workNo":this.createBy,
					}
					
				}).then(res => {
					if (res.data.success) {
						this.listData=res.data.result.records;
						this.listData.forEach(a =>{
							
						})
						if (this.listData.length <100) {
							this.endFlag = true;
							this.loadMoreText = "已显示全部数据"
						}
					}
				}).catch(err => {
					console.log(err);
				});
			},
			goDetailed(e,v){
				console.log(e)
				let info = {
					"month":v,
					"workNo":e
				};
				uni.navigateTo({
					url: '/packageA/mcloud/payDetailed?info=' + encodeURIComponent(JSON.stringify(info))
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	::v-deep .uni-select {
		font-size: 14px;
		border: 0px solid #dd524d;
		box-sizing: border-box;
		border-radius: 0px;
		padding: 0 5px;
		padding-left: 10px;
		position: relative;
		display: flex;
		-webkit-user-select: none;
		user-select: none;
		flex-direction: row;
		align-items: center;
		/*    border-bottom: solid 1px #e5e5e5; */
		border-left: solid 1px #e5e5e5;
		width: 100%;
		flex: 1;
		height: 50upx;
	}

	::v-deep .uni-stat__actived {
		width: 150rpx;
		flex: 1;
	}

	page {
		background: #FFFFFF;
		width: 750upx;
		overflow-x: hidden;
	}

	.bg-grey {
		background-color: rgb(234, 231, 231);
		padding: 2upx 20upx;

		.time-flex {
			display: flex;
			flex-wrap: wrap;

			.time-flex-item {
				width: 50%;
				text-align: center;
				height: 100upx;
				padding: 10upx 30upx;

				.time-flex-item-padding {
					background: #FFFFFF;
					height: 80upx;
					color: black;
					border-radius: 14upx;
					line-height: 80upx;
				}
				.time-flex-item-padding:active {
						background-color: #f5f5f5;
					}
			}
		}

		

		.conf-list {
			margin-top: -10upx;

			// 	height: 180upx;
			// background: greeen;
	// 		.conf-list-item:active {	// 	background-color: #f5f5f5;	// }
			.conf-list-item {
				height: 100upx;
				background: #FFFFFF;
				color: black;
				border-radius: 20upx;

				.conf-list-card {
					height: 100upx;
					border-radius: 20upx;
					margin-top: 20upx;

					.conf-list-title {
						height: 100upx;
						display: flex;
						padding: 6upx 20upx 0 20upx;
						justify-content: space-between;
						border-radius: 20upx 20upx 0upx 0upx;
						padding: 20upx 0 0 20upx;
						font-size: 28px;
					}
				}
			}
		}
	}


	
	




</style>
